﻿    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MvcEngine.Core.Registry
{
    public class ControllerCriteria : IFilterCriteria
    {
        private readonly List<string> controllers = new List<string>();

        #region IActionFilterCriteria Members

        public bool Match(ActionFilterRegistryContext context)
        {
            return controllers.Any(c => c == context.ControllerContext.Controller.ToString());
        }
            
        public void AddController(Type controllerType)
        {
            controllers.Add(controllerType.ToString());
        }

        #endregion
    }
}
